import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class worm here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class worm extends Actor
{
    /**
     * Act - do whatever the worm wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
     public void act()
    {
       move(5);
       turnAtEdge();
       keyControl();
    }
   
    public void turnAtEdge() {
      if(isAtEdge()){
         turn(6);
      }
    }
    public void keyControl(){
      if(Greenfoot.isKeyDown("left")) {
         turn(-10);
      }
      if(Greenfoot.isKeyDown("right")) {
         turn(10);
      }
    }

}
